﻿using Abp.Domain.Entities.Auditing;
using FutureApp.Users;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FutureApp.Shop
{
    /// <summary>
    /// 商品特征属性值
    /// </summary>
    [Table("GoodsAttributeValues")]
    public class GoodsAttributeValue : CreationAuditedEntity<Guid, User>
    {
        /// <summary>
        /// <see cref="Value"/> 属性的最大长度
        /// </summary>
        public const int MaxValueLength = 500;

        /// <summary>
        /// 商品特征属性Id
        /// </summary>
        [Required]
        public virtual Guid AttibuteId { get; set; }

        /// <summary>
        /// 商品特征属性
        /// </summary>
        [ForeignKey(nameof(AttibuteId))]
        public virtual GoodsAttribute Attribute { get; set; }

        /// <summary>
        /// 特征属性值
        /// </summary>
        [Required]
        [StringLength(MaxValueLength)]
        public virtual string Value { get; set; }
    }
}
